//
//  UITextField+DDPickerView.m
//  DDPickerKeyboardView
//
//  Created by zhipeng on 16/11/10.
//  Copyright © 2016年 lqd. All rights reserved.
//

#import "UITextField+DDPickerView.h"

@implementation UITextField (DDPickerView)
- (void)dd_KeyBoardPickerViewWithDelegate : (id<DDInputPickerViewDelegate>)delegate
                       InputAccessoryView : (DDInputAccessoryPickerView *)inputAccessoryView
                                InputView : (DDInputPickerView *)inputView
{
    inputView.delegate = delegate;
    self.inputView = inputView;
    [inputAccessoryView leftBlock:^{
        [inputView sendConfirm];
        if ([self isFirstResponder]) {
            [self resignFirstResponder];
        }
    }];
    [inputAccessoryView rightBlock:^{
        if (inputView.delegate && [inputView.delegate respondsToSelector:@selector(cancelSelected)]) {
            [inputView.delegate cancelSelected];
        }
        if ([self isFirstResponder]) {
            [self resignFirstResponder];
        }
    }];
    self.inputAccessoryView = inputAccessoryView;
}
@end
